<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./vue.js"></script>
</head>
<body>
    <div id="app">
        <!-- <input type="text" @keyup.enter="sub" v-model="str" /> -->
        <!-- <button @keyup.enter="sub">1111</button> -->
        {{str}}
    </div>
    <script>
        
        new Vue({
            el:"#app",
            data:{
                str:"111"
            },
            mounted:function(){
                console.log("dom结构渲染完毕");
                // let that = this;
                document.onkeyup = (e)=>{
                    let key = e.key;
                    // console.log(key);
                    if(key=="Enter"){
                        this.str = "修改了";
                    }
                }
            },
            methods:{
                sub(){
                console.log("enter按了")
                }
            }
        })



    </script>
</body>
</html>